<?php
/**
 * Created by PhpStorm.
 * User: wangkxin@foxmail.com
 * Date: 2022/8/2
 * Time: 11:32
 */

namespace app\index\controller;


use app\BaseController;
use app\listener\TestListen;
use think\App;
use think\Facade\Event;

class TestEvent extends BaseController
{
    public function __construct()
    {
       Event::listen('TestListen',function ($a){
           echo '监听器被触发'.$a;
       });
    }

    public function info(){
        echo '登录前的准备';
        event('TestListen','测试233');
    }


    public function info1()
    {
        echo '登录前的准备';
        Event::listen('abc',TestListen::class);
        event('abc','滚吧');
    }


    public function index()
    {
        return 'dfdfd';
    }
}